<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery.min.js"></script>
</head>

<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <script>
        $(function () {
            var arr = ["red", "blue", "black"];
            var sum = 0;
            $("div").each(function (index, domEle) {
                $(domEle).css("color", arr[index]);
                sum += parseInt($(domEle).html());
            })
            console.log(sum);
        })
    </script>
</body>

</html>